//
//  ViewController.m
//  ThusMyStyle
//
//  Created by Ran on 15/9/30.
//  Copyright (c) 2015年 gintong. All rights reserved.
//

#import "ViewController.h"
#import "RanPager.h"
#import "RanTool.h"

@interface ViewController ()<RanPagerDelegate>

@property(nonatomic, strong)RanPager *pager;

@end

@implementation ViewController


- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor purpleColor];

    NSAttributedString *n1 = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:14] color:[UIColor blackColor] string:@"大苹果红"];
    }];
    
    NSAttributedString *n2 = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:14] color:[UIColor blackColor] string:@"青草绿"];
    }];
    
    NSAttributedString *n3 = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:14] color:[UIColor blackColor] string:@"橙黄"];
    }];
    
    NSAttributedString *n4 = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:14] color:[UIColor blackColor] string:@"忧郁蓝"];
    }];
    
    NSAttributedString *n11 = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:16] color:[UIColor orangeColor] string:@"大苹果红"];
    }];
    
    NSAttributedString *n22 = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:16] color:[UIColor orangeColor] string:@"青草绿"];
    }];
    
    NSAttributedString *n33 = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:16] color:[UIColor orangeColor] string:@"橙黄"];
    }];
    
    NSAttributedString *n44 = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:16] color:[UIColor orangeColor] string:@"忧郁蓝"];
    }];

    self.pager = [[RanPager alloc] init];
    self.pager.headerModel.titleArray = @[@"大苹果红", @"青草绿", @"橙黄", @"忧郁蓝"];
    self.pager.headerModel.headerButtonStyle = RanPagerHeaderButtonStyleConstantWidth;
    self.pager.headerModel.bottomLineMoveInRealTime = YES;
    self.pager.headerModel.headerButtonWidth = 80;
    self.pager.headerModel.seperatorInsets = UIEdgeInsetsMake(5, 3.5, 5, 0);
    self.pager.headerModel.seperatorColor = [UIColor purpleColor];
    self.pager.headerModel.showSeperator = YES;
    self.pager.delegate = self;
    [self.pager addContentViewToView:self.view withFrame:CGRectMake(22, 166, 300, 400)];
    [self.pager addHeaderViewToView:self.view withFrame:CGRectMake(10, 66, 321, 40)];
}

- (UIView *)pager:(RanPager *)pager contentViewAtIndex:(NSInteger)index
{
    UIView *view = [[UIView alloc] init];
    UIColor *color;
    switch (index) {
        case 0:
            color = [UIColor redColor];
            break;
        case 1:
            color = [UIColor greenColor];
            break;
        case 2:
            color = [UIColor yellowColor];
            break;
        case 3:
            color = [UIColor blueColor];
            break;
        default:
            color = [UIColor purpleColor];
            break;
    }
    view.backgroundColor = color;
    return view;
}


@end
